import { MessageBox, Notification } from 'element-ui';

export default function errHandle(data) {
  const { code, msg } = data;
  console.log('=====data===', data);
  switch (code) {
    case 100001: {
      Notification({
        title: '错误',
        message: msg,
        type: 'error',
      });
      break;
    }
    case 100004: {
      Notification({
        title: '参数错误',
        message: msg,
        type: 'error',
      });
      break;
    }
    case 100012: {
      MessageBox.alter('您的登录已过期，请重新登录', '登录', {
        callback: (action) => {
          this.$message({
            type: 'info',
            message: `action: ${action}`,
          });
        },
      });
      break;
    }
    default:
  }
}
